Imports System
Imports Microsoft.Health.Web

    ''' <summary>
    ''' Creates OfflineWebApplicationConnection to HealthVault
    ''' </summary>
    Friend Class HealthVaultConnectionManager
        ''' <summary>
        ''' Creates Offline Web Application Connection
        ''' </summary>
        ''' <param name="applicationId">Application Id used for creating the offline connection</param>
        ''' <param name="personId">Person Id who granted permission to perform operation</param>
        ''' <returns>Returns authentication connection</returns>
    Public Shared Function CreateConnection(ByVal applicationId As Guid, ByVal personId As Guid) As OfflineWebApplicationConnection
        Dim offlineConn As New OfflineWebApplicationConnection(applicationId, _
            WebApplicationConfiguration.HealthServiceUrl, personId)
        offlineConn.Authenticate()
        Return offlineConn
    End Function

        ''' <summary>
        ''' Create Offline Web Application Connection
        ''' </summary>
        ''' <param name="applicationId">Application ID used for creating the offline connection</param>
        ''' <returns>reference to OfflineWebApplicationConnection</returns>
        Public Shared Function CreateConnection(ByVal applicationId As Guid)
            Dim offlineConn As New OfflineWebApplicationConnection(applicationId, WebApplicationConfiguration.HealthServiceUrl, Guid.Empty)
            offlineConn.Authenticate()
            Return offlineConn
        End Function

    End Class

